home *** CD-ROM | disk | FTP | other *** search
/ Especial Multimedia / Especial Multimedia.iso / Multimed / Prg / KALENDAR.ZIP / TEST.FRM < prev    next >
Text File  |  1997-09-14  |  15KB  |  478 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Kalendar Settings"
  6.    ClientHeight    =   4350
  7.    ClientLeft      =   3195
  8.    ClientTop       =   345
  9.    ClientWidth     =   6375
  10.    Height          =   4755
  11.    Left            =   3135
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   4350
  14.    ScaleWidth      =   6375
  15.    Top             =   0
  16.    Width           =   6495
  17.    Begin ComboBox cmbDateFormat 
  18.       Height          =   300
  19.       Left            =   4455
  20.       Style           =   2  'Dropdown List
  21.       TabIndex        =   18
  22.       Top             =   3870
  23.       Width           =   1845
  24.    End
  25.    Begin ComboBox cmbLanguage 
  26.       Height          =   300
  27.       Left            =   4440
  28.       Style           =   2  'Dropdown List
  29.       TabIndex        =   15
  30.       Top             =   3345
  31.       Width           =   1845
  32.    End
  33.    Begin ComboBox cmbDOWAlignment 
  34.       BackColor       =   &H00FFFFFF&
  35.       Height          =   300
  36.       Left            =   4440
  37.       Style           =   2  'Dropdown List
  38.       TabIndex        =   13
  39.       Top             =   2820
  40.       Width           =   1845
  41.    End
  42.    Begin ComboBox cmbHeadingAlign 
  43.       BackColor       =   &H00FFFFFF&
  44.       Height          =   300
  45.       Left            =   4440
  46.       Style           =   2  'Dropdown List
  47.       TabIndex        =   11
  48.       Top             =   2310
  49.       Width           =   1845
  50.    End
  51.    Begin CheckBox chkShowAllDays 
  52.       BackColor       =   &H00C0C0C0&
  53.       Caption         =   "Show All Days"
  54.       Height          =   225
  55.       Left            =   2415
  56.       TabIndex        =   10
  57.       Top             =   4035
  58.       Width           =   1575
  59.    End
  60.    Begin CheckBox chkFixed 
  61.       BackColor       =   &H00C0C0C0&
  62.       Caption         =   "Fixed Day Height"
  63.       Height          =   225
  64.       Left            =   75
  65.       TabIndex        =   8
  66.       Top             =   4035
  67.       Width           =   1815
  68.    End
  69.    Begin ComboBox cmbAlignment 
  70.       BackColor       =   &H00FFFFFF&
  71.       Height          =   300
  72.       Left            =   4440
  73.       Style           =   2  'Dropdown List
  74.       TabIndex        =   7
  75.       Top             =   1830
  76.       Width           =   1845
  77.    End
  78.    Begin ComboBox cmbFirstDOW 
  79.       BackColor       =   &H00FFFFFF&
  80.       Height          =   300
  81.       Left            =   4440
  82.       Style           =   2  'Dropdown List
  83.       TabIndex        =   4
  84.       Top             =   1335
  85.       Width           =   1845
  86.    End
  87.    Begin ComboBox cmbStyle 
  88.       BackColor       =   &H00FFFFFF&
  89.       Height          =   300
  90.       Left            =   4440
  91.       Style           =   2  'Dropdown List
  92.       TabIndex        =   2
  93.       Top             =   855
  94.       Width           =   1845
  95.    End
  96.    Begin Kalendar Kalendar1 
  97.       ArrowDelay      =   500
  98.       BackColor       =   &H00FFFFFF&
  99.       BorderStyle     =   1  'Fixed Single
  100.       CalendarFormat  =   0  'Month
  101.       ChgOnOtherMon   =   -1  'True
  102.       DateDispStyle   =   0  'Normal
  103.       DayAlignment    =   8  'Bottom Right
  104.       DOWAlign        =   2  'Center
  105.       DOWBackColor    =   &H00C0C0C0&
  106.       DOWBorder       =   -1  'True
  107.       DOWDispStyle    =   2  'Medium
  108.       DOWFontBold     =   -1  'True
  109.       DOWFontItalic   =   0   'False
  110.       DOWFontName     =   "MS Sans Serif"
  111.       DOWFontSize     =   8.25
  112.       DOWFontStrikeThru=   0   'False
  113.       DOWFontUnderline=   0   'False
  114.       DOWForeColor    =   &H00000000&
  115.       EnableKeys      =   -1  'True
  116.       FirstDOW        =   0  'Sunday
  117.       FixedDayHeight  =   0   'False
  118.       ForeColor       =   &H00000000&
  119.       Height          =   3645
  120.       Language        =   0  'English
  121.       Left            =   15
  122.       LineColor       =   &H00000000&
  123.       MonAlign        =   0  'Left
  124.       MonBackColor    =   &H00C0C0C0&
  125.       MonDispStyle    =   2  'Month/Year
  126.       MonFontBold     =   -1  'True
  127.       MonFontItalic   =   0   'False
  128.       MonFontName     =   "Arial"
  129.       MonFontSize     =   12
  130.       MonFontStrikeThru=   0   'False
  131.       MonFontUnderline=   0   'False
  132.       MonForeColor    =   &H00000000&
  133.       OtherMonBackColor=   &H00C0C0C0&
  134.       OtherMonForeColor=   &H00FFFFFF&
  135.       SelDayBackColor =   &H00C0C0C0&
  136.       SelDayForeColor =   &H00000000&
  137.       ShowAllDays     =   0   'False
  138.       ShowArrows      =   -1  'True
  139.       ShowLines       =   -1  'True
  140.       ShowSelection   =   -1  'True
  141.       TabIndex        =   0
  142.       TabStop         =   0   'False
  143.       Text            =   "09/26/94"
  144.       TextFormat      =   0  'mdy
  145.       Top             =   360
  146.       Width           =   4230
  147.    End
  148.    Begin Label Label9 
  149.       BackColor       =   &H00C0C0C0&
  150.       Caption         =   "Date Format"
  151.       Height          =   195
  152.       Left            =   4455
  153.       TabIndex        =   17
  154.       Top             =   3660
  155.       Width           =   1215
  156.    End
  157.    Begin Label Label8 
  158.       BackColor       =   &H00C0C0C0&
  159.       Caption         =   "Language"
  160.       Height          =   210
  161.       Left            =   4455
  162.       TabIndex        =   16
  163.       Top             =   3120
  164.       Width           =   1350
  165.    End
  166.    Begin Label Label7 
  167.       BackColor       =   &H00C0C0C0&
  168.       Caption         =   "DOW Alignment"
  169.       Height          =   195
  170.       Left            =   4440
  171.       TabIndex        =   14
  172.       Top             =   2625
  173.       Width           =   1350
  174.    End
  175.    Begin Label Label1 
  176.       Alignment       =   2  'Center
  177.       AutoSize        =   -1  'True
  178.       BackColor       =   &H00C0C0C0&
  179.       Caption         =   "Label1"
  180.       FontBold        =   0   'False
  181.       FontItalic      =   0   'False
  182.       FontName        =   "Arial"
  183.       FontSize        =   13.5
  184.       FontStrikethru  =   0   'False
  185.       FontUnderline   =   0   'False
  186.       ForeColor       =   &H00000000&
  187.       Height          =   315
  188.       Left            =   0
  189.       TabIndex        =   1
  190.       Top             =   0
  191.       Width           =   4245
  192.    End
  193.    Begin Label Label6 
  194.       BackColor       =   &H00C0C0C0&
  195.       Caption         =   "Month Alignment"
  196.       Height          =   195
  197.       Left            =   4440
  198.       TabIndex        =   12
  199.       Top             =   2130
  200.       Width           =   1425
  201.    End
  202.    Begin Label Label5 
  203.       Alignment       =   2  'Center
  204.       BackColor       =   &H00FFFF00&
  205.       BorderStyle     =   1  'Fixed Single
  206.       Caption         =   "Sampling of the properties that Kalendar provides."
  207.       Height          =   645
  208.       Left            =   4440
  209.       TabIndex        =   9
  210.       Top             =   -15
  211.       Width           =   1830
  212.    End
  213.    Begin Label Label4 
  214.       BackColor       =   &H00C0C0C0&
  215.       Caption         =   "Day Alignment"
  216.       Height          =   195
  217.       Left            =   4440
  218.       TabIndex        =   6
  219.       Top             =   1635
  220.       Width           =   1230
  221.    End
  222.    Begin Label Label3 
  223.       BackColor       =   &H00C0C0C0&
  224.       Caption         =   "First Day of Week"
  225.       Height          =   195
  226.       Left            =   4440
  227.       TabIndex        =   5
  228.       Top             =   1155
  229.       Width           =   1545
  230.    End
  231.    Begin Label Label2 
  232.       BackColor       =   &H00C0C0C0&
  233.       Caption         =   "Display Style"
  234.       Height          =   195
  235.       Left            =   4440
  236.       TabIndex        =   3
  237.       Top             =   645
  238.       Width           =   1110
  239.    End
  240. End
  241. Option Explicit
  242.  
  243. Sub chkFixed_Click ()
  244.     Kalendar1.FixedDayHeight = chkFixed.Value
  245. End Sub
  246.  
  247. Sub chkShowAllDays_Click ()
  248.     Kalendar1.ShowAllDays = chkShowAllDays.Value
  249. End Sub
  250.  
  251. Sub cmbAlignment_Click ()
  252.     Kalendar1.DayAlignment = cmbAlignment.ListIndex
  253. End Sub
  254.  
  255. Sub cmbDateFormat_Click ()
  256.     Kalendar1.TextFormat = cmbDateFormat.ListIndex
  257.     ' Make sure change gets noticed.
  258.     Label1.Caption = "Date: " & Kalendar1.Text
  259. End Sub
  260.  
  261. Sub cmbDOWAlignment_Click ()
  262.     Kalendar1.DOWAlign = cmbDOWAlignment.ListIndex
  263. End Sub
  264.  
  265. Sub cmbFirstDOW_Click ()
  266.     Kalendar1.FirstDOW = cmbFirstDOW.ListIndex
  267. End Sub
  268.  
  269. Sub cmbHeadingAlign_Click ()
  270.     Kalendar1.MonAlign = cmbHeadingAlign.ListIndex
  271. End Sub
  272.  
  273. Sub cmbLanguage_Click ()
  274.     Kalendar1.Language = cmbLanguage.ListIndex
  275. End Sub
  276.  
  277. Sub cmbStyle_Click ()
  278.  
  279.     Select Case cmbStyle.ListIndex
  280.         Case 0
  281.             ' Get back the original colors.
  282.             Kalendar1.BackColor = RGB(255, 255, 255)
  283.             Kalendar1.ForeColor = 0
  284.             Kalendar1.SelDayBackColor = RGB(192, 192, 192)
  285.             Kalendar1.SelDayForeColor = 0
  286.             Kalendar1.LineColor = 0
  287.         Case 1
  288.             ' Get back the original colors.
  289.             Kalendar1.BackColor = &HC0C0C0
  290.             Kalendar1.ForeColor = 0
  291.             Kalendar1.SelDayBackColor = &HE0E0E0
  292.             Kalendar1.SelDayForeColor = 0
  293.             Kalendar1.LineColor = 0
  294.     End Select
  295.     Kalendar1.DateDispStyle = cmbStyle.ListIndex
  296. End Sub
  297.  
  298. Sub Form_Activate ()
  299.     SetDescription Sample1Description()
  300. End Sub
  301.  
  302. Sub Form_Load ()
  303. Dim i As Integer
  304.  
  305.     Kalendar1.Text = Date
  306.  
  307.     SetUpCombos
  308.  
  309. End Sub
  310.  
  311. Sub Kalendar1_ClickDay ()
  312.     Label1.Caption = "Date: " & Kalendar1.Text
  313. End Sub
  314.  
  315. Sub Kalendar1_DblClickDay ()
  316.     MsgBox "A Double Click! " & Kalendar1.Text
  317. End Sub
  318.  
  319. Sub Kalendar1_DragDrop (Source As Control, x As Single, y As Single)
  320. Dim tmpDay As String
  321.  
  322.     Kalendar1.PointX = x
  323.     Kalendar1.PointY = y
  324.  
  325.     tmpDay = Kalendar1.DateAtPoint
  326.     If tmpDay <> "" Then
  327.         Kalendar1.Text = Kalendar1.DateAtPoint
  328.         MsgBox "You dropped " & Source.Caption
  329.     End If
  330. End Sub
  331.  
  332. Sub Kalendar1_DragOver (Source As Control, x As Single, y As Single, State As Integer)
  333. Dim tmpDay As String
  334.     Kalendar1.PointX = x
  335.     Kalendar1.PointY = y
  336.  
  337.     tmpDay = Kalendar1.DateAtPoint
  338.     If tmpDay <> "" Then
  339.         Kalendar1.Text = Kalendar1.DateAtPoint
  340.     End If
  341. End Sub
  342.  
  343. ' This DrawDay function shows the easy way to customize the look of a Kalendar.
  344. ' It's easier because it does not rely on any Windows API calls, but instead
  345. ' changes some of the display properties of the Kalendar (color & font properties).
  346. ' Generally when responding to DrawDay, the Cancel parameter should be set to True.
  347. ' But by not setting it to true in this case, Kalendar will draw the day with the
  348. ' new properties that were set.
  349. Sub Kalendar1_DrawDay (hdc As Integer, State As Integer, theDay As Long, x As Single, y As Single, x2 As Single, y2 As Single, Cancel As Integer)
  350. Dim DOW As Integer
  351.  
  352.     DOW = Format(theDay, "w")
  353.  
  354.     Select Case State
  355.         Case KAL_STATE_NOT_SELECTED:
  356.             If DOW = 1 Or DOW = 7 Then
  357.                 Kalendar1.BackColor = RGB(128, 0, 128)
  358.                 Kalendar1.FontName = "Arial"
  359.                 Kalendar1.FontSize = 18
  360.             Else
  361.                 Kalendar1.BackColor = RGB(255, 0, 255)
  362.                 Kalendar1.LineColor = RGB(255, 0, 255)
  363.                 Kalendar1.FontName = "Times New Roman"
  364.                 Kalendar1.FontSize = 8.25
  365.             End If
  366.     
  367.         Case KAL_STATE_SELECTED_WITH, KAL_STATE_SELECTED_WITHOUT:
  368.             If DOW = 1 Or DOW = 7 Then
  369.                 Kalendar1.SelDayBackColor = RGB(255, 0, 0)
  370.                 Kalendar1.LineColor = RGB(255, 0, 0)
  371.                 Kalendar1.FontName = "Arial"
  372.                 Kalendar1.FontSize = 18
  373.             Else
  374.                 Kalendar1.SelDayBackColor = RGB(192, 0, 0)
  375.                 Kalendar1.LineColor = RGB(192, 0, 0)
  376.                 Kalendar1.FontName = "Times New Roman"
  377.                 Kalendar1.FontSize = 8.25
  378.             End If
  379.  
  380.         Case KAL_STATE_OTHERMONTH:
  381.             If DOW = 1 Or DOW = 7 Then
  382.                 Kalendar1.OtherMonBackColor = RGB(128, 0, 128)
  383.                 Kalendar1.FontName = "Arial"
  384.                 Kalendar1.FontSize = 18
  385.             Else
  386.                 Kalendar1.OtherMonBackColor = RGB(255, 0, 255)
  387.                 Kalendar1.FontName = "Times New Roman"
  388.                 Kalendar1.FontSize = 8.25
  389.             End If
  390.     End Select
  391.  
  392.     If DOW = 1 Or DOW = 7 Then
  393.         Kalendar1.DayAlignment = 4
  394.         Kalendar1.LineColor = RGB(0, 255, 0)
  395.         Kalendar1.ForeColor = RGB(255, 255, 255)
  396.     Else
  397.         Kalendar1.DayAlignment = 0
  398.         Kalendar1.LineColor = RGB(0, 255, 255)
  399.         Kalendar1.ForeColor = RGB(0, 0, 0)
  400.     End If
  401.  
  402. End Sub
  403.  
  404. Function Sample1Description () As String
  405. Dim CR As String
  406. Dim s As String
  407.  
  408.     s = "This sample highlights some of the flexibilty of a Kalendar."
  409.     s = s & "The most interesting property is the Display Style (DayDispStyle), by setting this property you can: " & CR
  410.     s = s & "   1) Let the custom control draw itself based on the selected properties. (Ho hum)" & CR
  411.     s = s & "   2) Let the custom control draw the day boxes like 3-D buttons. (Yipee)" & CR
  412.     s = s & "   3) Draw the day boxes yourself. (Cool!)"
  413.     s = s & "When you select the user defined drawing method (number 3), you have several options for affecting how a day box is drawn. "
  414.     s = s & "This sample simply changes the background color of a day and the day alignment based on the day of the week. "
  415.     s = s & "Other samples in this demo show how you can draw on top of each day box, or even draw the entire day box itself."
  416.  
  417.     Sample1Description = s
  418. End Function
  419.  
  420. Sub SetUpCombos ()
  421.     cmbStyle.AddItem "Normal"
  422.     cmbStyle.AddItem "3D"
  423.     cmbStyle.AddItem "User-Defined"
  424.  
  425.     cmbStyle.ListIndex = 0
  426.  
  427.     cmbFirstDOW.AddItem "Sunday"
  428.     cmbFirstDOW.AddItem "Monday"
  429.     cmbFirstDOW.AddItem "Tuesday"
  430.     cmbFirstDOW.AddItem "Wednesday"
  431.     cmbFirstDOW.AddItem "Thursday"
  432.     cmbFirstDOW.AddItem "Friday"
  433.     cmbFirstDOW.AddItem "Saturday"
  434.     cmbFirstDOW.ListIndex = 0
  435.  
  436.     cmbAlignment.AddItem "Upper Left"
  437.     cmbAlignment.AddItem "Upper Center"
  438.     cmbAlignment.AddItem "Upper Right"
  439.     cmbAlignment.AddItem "Mid Left"
  440.     cmbAlignment.AddItem "Mid Center"
  441.     cmbAlignment.AddItem "Mid Right"
  442.     cmbAlignment.AddItem "Lower Left"
  443.     cmbAlignment.AddItem "Lower Center"
  444.     cmbAlignment.AddItem "Lower Right"
  445.     cmbAlignment.ListIndex = 0
  446.  
  447.     cmbHeadingAlign.AddItem "Left"
  448.     cmbHeadingAlign.AddItem "Right"
  449.     cmbHeadingAlign.AddItem "Center"
  450.     cmbHeadingAlign.ListIndex = 2
  451.  
  452.     cmbDOWAlignment.AddItem "Left"
  453.     cmbDOWAlignment.AddItem "Right"
  454.     cmbDOWAlignment.AddItem "Center"
  455.     cmbDOWAlignment.ListIndex = 2
  456.  
  457.     cmbLanguage.AddItem "English"
  458.     cmbLanguage.AddItem "French"
  459.     cmbLanguage.AddItem "Spanish"
  460.     cmbLanguage.AddItem "Italian"
  461.     cmbLanguage.AddItem "Portuguese"
  462.     cmbLanguage.AddItem "German"
  463.     cmbLanguage.AddItem "Dutch"
  464.     cmbLanguage.AddItem "Swedish"
  465.     cmbLanguage.AddItem "Danish"
  466.     cmbLanguage.AddItem "Norwegian"
  467.     cmbLanguage.AddItem "Polish"
  468.     cmbLanguage.AddItem "Finnish"
  469.     cmbLanguage.ListIndex = 0
  470.  
  471.     cmbDateFormat.AddItem "mdy"
  472.     cmbDateFormat.AddItem "dmy"
  473.     cmbDateFormat.AddItem "ymd"
  474.     cmbDateFormat.ListIndex = 0
  475.  
  476. End Sub
  477.  
  478.